import { useEffect, useState } from 'react';
import WTable from '@/components/WTable';

const TableMain = () => {
	const [data, setData] = useState([]);

	useEffect(() => {
		const list = [];
		for (let i = 1; i <= 20; i++) {
			list.push({
				id: i,
				title: `标题标题标题标题标题标题标题标题${i}`,
				address: `地址地址地址地址地址地址地址地址地址地址${i}`,
				status: i % 2
			});
		}
		// console.log(list);
		setData(list);
	}, []);

	return (
		<WTable
			height={500}
			columns={[
				{ title: '标题', key: 'title', width: 250, minWidth: 200, ellipsis: true, resizable: true },
				{ title: '地址', key: 'address', width: 250, ellipsis: true },
				{ title: 'a', key: 'a' },
				{ title: 'b', key: 'b' },
				{ title: 'c', key: 'c' },
				{ title: 'd', key: 'd' },
				{ title: '状态', key: 'status' }
			]}
			dataSource={data}
		/>
	);
};

export default TableMain;
